<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- <link rel="stylesheet" href="https://at.alicdn.com/t/font_3428838_q9653kfydud.css"> -->
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        .dh1 {
            width: 300px;
            height: 450px;
            border-radius: 50%;
            margin: 20px auto;
            background: -webkit-linear-gradient(top, skyblue, pink);
            overflow: hidden;
        }

        h3,
        p {
            text-align: center;
            color: white;
        }

        h3 {
            font-size: 34px;
            margin-top: 50px;
            font-weight: bolder;
        }

        .day {
            color:rgb(236, 6, 201);         
            font-size: 66px;
            text-align: right;

        }

        .day1 {
            height: 60px;
            line-height: 50px;
            /* color: red; */
            font-size: 66px;
            text-align: left;

        }

        .dh {
            height: 50px;
            width: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
            margin: 50px 0;
            color:rgb(236, 6, 201);        
        }

        .time {
            font-size: 28px;
            margin: 20px 0 30px 0;
        }

        .good {
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            color: black;
        }

        .h,
        .m,
        .s {
            display: block;
            width: 50px;
            height: 50px;
            background: black;
            color: white;
            margin: 0 12px;
            font-size: 28px;
            text-align: center;
            line-height: 50px;
        }
    </style>
</head>

<body>
    <div class="dh1">
        <h3>双11倒计时</h3>
        <!-- <i class="iconfont icon-lightning-01"></i> -->
        <div class="dh">
            <p class="day"></p>
            <span class="day1">天</span>
        </div>
        <p class="time">距双11还有</p>
        <p class="good"><span class="h"></span>:<span class="m"></span>:<span class="s"></span></p>
    </div>
 
    <script>
        let day = document.querySelector('.day');
        let h1 = document.querySelector('.h');
        let m1 = document.querySelector('.m');
        let s1 = document.querySelector('.s');
        setInterval(() => {
            let d1 = +new Date();   // + 获取毫秒数
            let d2 = +new Date('2022-11-11 00:00:00');
            let differ = (d2 - d1) / 1000;
            // console.log(differ);

            let s = parseInt(differ % 60);
            let m = parseInt(differ / 60 % 60);
            let h = parseInt(differ / 60 / 60 % 24);
            let d = parseInt(differ / 60 / 60 / 24);
            console.log(s, m, h, d);
            s = s < 10 ? '0' + s : s;
            m = m < 10 ? '0' + m : m;
            h = h < 10 ? '0' + h : h;
            d = d < 10 ? '0' + d : d;
            day.innerHTML = d;
            h1.innerHTML = h;
            m1.innerHTML = m;
            s1.innerHTML = s;

        }, 1000);
    </script>
</body>

</html>